package com.letou.ls.mode;

import java.util.ArrayList;

import com.letou.ls.uitl.Logger;

public class TableTitle {
	private static final String TAG = "TableTitle";
	/**
	 * 头结点col对象。
	 */
	private Col mFirstCol;
	/**
	 * 当前结点.
	 */
	private Col mCurrentCol;
	/**
	 * 当前层。
	 */

	private float dataTextSize;
	private int mNumber;
	private int mMaxNumber;
	public ArrayList<Float> mWidthList;
	public ArrayList<Float> mHeightList;
	public ArrayList<ArrayList<String>> mDataList;
	public ArrayList<ArrayList<String>> mTypeList;
	public int leftWidth;
	public int topHeight;
	public int rootHeight;
	public int rootWidth;
	public float dataWidth = 0;
	public float dataHeight = 0;

	public float getDataTextSize() {
		return dataTextSize;
	}

	public void setDataTextSize(float dataTextSize) {
		this.dataTextSize = dataTextSize;
	}

	private float height;

	public void addWidthList(float width) {
		if (mWidthList == null) {
			mWidthList = new ArrayList<Float>();
		}
		mWidthList.add(width);
	}

	public ArrayList<Float> getmWidthList() {
		return mWidthList;
	}

	public float getDataWidth() {
		return dataWidth;
	}

	public float getHeight() {
		return height;
	}

	public void setHeight(float height) {
		this.height = height;
	}

	public int getmNumber() {
		return mNumber;
	}

	public void setmNumber(int mNumber) {
		this.mNumber = mNumber;
	}

	public int getmMaxNumber() {
		return mMaxNumber;
	}

	public void setmMaxNumber(int mMaxNumber) {
		this.mMaxNumber = mMaxNumber;
	}

	public Col getFirstCol() {
		return mFirstCol;
	}

	/**
	 * 添加第一个结点。
	 */
	public void addFirstCol() {
		if (mFirstCol == null) {
			mFirstCol = new Col();
			mCurrentCol = mFirstCol;
			mCurrentCol.setmFatherCol(mFirstCol);
			mCurrentCol = mFirstCol;
			mNumber = 0;
			mMaxNumber = 0;
		}
	}

	/**
	 * 向当前结点添加col；
	 */
	public void addCurrentColChild(Col col) {
		Logger.v(TAG, "addCurrentColChild  ===========>  " + mNumber);
		if (col != null) {
			col.setmNumber(mNumber);
			mCurrentCol.addChildren(col);
		}
	}

	/**
	 * 向上一层结点走一步。
	 */
	public void goToForward() {
		mCurrentCol = mCurrentCol.getmFatherCol();
		mNumber--;
	}

	/**
	 * 向下一层结点走一步。
	 */
	public void goToAfter() {
		mCurrentCol = mCurrentCol.getCurrentChild();
		mNumber++;
		Logger.v(TAG, "goToAfter   mNumber  " + mNumber);
		if (mMaxNumber < mNumber) {
			mMaxNumber = mNumber;
		}
	}

	/**
	 * 获得当前结点。
	 * 
	 * @return 当前结点。
	 */
	public Col getCurrentCol() {
		return mCurrentCol;
	}

	/**
	 * 获得数据结点。
	 */
	public Col getDataCol() {
		return mFirstCol.getCurrentChild();
	}

//	public void toShow(Col col) {
//		int size = col.getmChildrenSize();
//		Logger.v(TAG, " colname : " + col.getmNumber() + " " + col.getmColName());
//		if (size > 0) {
//			for (int index = 0; index < size; index++) {
//				toShow(col.getmChildList().get(index));
//			}
//		}
//	}
}
